function createPopup(idform){
	var popup = open("", "Popup", "width=440, height=227");
	
	var txtOk = popup.document.createElement("TEXTAREA");
	txtOk.cols = 50;
	txtOk.rows = 10;
	txtOk.placeholder = "Escriba aquí el motivo del rechazo.";

	var buttonOk = popup.document.createElement("BUTTON");
	buttonOk.innerHTML = "Enviar";
	buttonOk.onclick = function(){
						document.getElementById(idform).innerHTML+='<input class="fields" type"text" name="mensaje" value="'+txtOk.value+'"/>';
						document.getElementById(idform).submit();
						popup.close();
					}

	var buttonCancel = popup.document.createElement('BUTTON');
    buttonCancel.className = 'cancel';
    buttonCancel.innerHTML = 'Cancelar';
    buttonCancel.onclick= function(){popup.close();}
    
	popup.document.body.appendChild(txtOk);
	popup.document.body.appendChild(buttonOk);
	popup.document.body.appendChild(buttonCancel);
}

function checkoption(idform, nombre){
	var formulario = document.getElementById(idform);

	for (i=0;i<formulario[nombre].length;i++) {
		if (formulario[nombre][i].checked) {
			x = formulario[nombre][i].value;
		}	
	}

	if (x==1){
		document.getElementById(idform).submit();
	}else{
		createPopup(idform);
	}
}

function popconfirm(iduniv){
	var popup = open("", "Popup", "width=350, height=50");
	var buttonOk = popup.document.createElement("BUTTON");
	buttonOk.innerHTML = "Si";
	buttonOk.onclick = function(){
						popup.opener.location.href="/plataforma/universidades/admin_universidades/"+iduniv;
						popup.close();
					}

	var buttonCancel = popup.document.createElement('BUTTON');
    buttonCancel.innerHTML = 'No';
    buttonCancel.onclick= function(){popup.close();}
    popup.document.body.innerHTML='<p>Esta seguro que desea borrar esta universidad?</p>';
    popup.document.body.appendChild(buttonOk);
	popup.document.body.appendChild(buttonCancel);	
}
